#ifndef MATRIX4
#define MATRIX4

#include <stdio.h>
#include <cstring>

struct Matrix4
{
	float data[4][4];

	Matrix4()
	{
		float d[4][4] = {
			{1, 0, 0, 0},
			{0, 1, 0, 0},
			{0, 0, 1, 0},
			{0, 0, 0, 1}
		};

		memcpy( data, d, sizeof(float)*4*4 );
	}

	Matrix4( float d[4][4] )
	{
		memcpy( data, d, sizeof(float)*4*4 );
	}

	Matrix4 operator*(const Matrix4& B)
	{
		Matrix4 theMatrix;

		for (int r=0; r < 4;r++) {
			for (int c=0;c < 4;c++) {
				theMatrix.data[c][r] = 0;
				for (int i=0; i < 4;i++) {
					theMatrix.data[c][r] += data[i][r]*B.data[c][i];
				}
			}
		}

		return theMatrix;
	}
};

#endif MATRIX4